package kr.hkit.androidcomplete03.ETC;

import kr.hkit.androidcomplete03.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;

public class WebBroserTest extends Activity {
	EditText edtUrl;
	Button btnGo, btnBack;
	WebView web;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.webbroser);
		
		edtUrl = (EditText) findViewById(R.id.editWebAdd);
		btnGo = (Button) findViewById(R.id.searchBtn);
		btnBack = (Button) findViewById(R.id.backBtn);
		web = (WebView) findViewById(R.id.webView1);
		
		web.setWebViewClient(new CookWebViewClient());
		
		WebSettings webSet = web.getSettings();
		webSet.setBuiltInZoomControls(true);
		
		btnGo.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				web.loadUrl(edtUrl.getText().toString());				
			}
			
		});
		
		btnBack.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				web.goBack();
			}
			
		});
	}
	
	class CookWebViewClient extends WebViewClient {

		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			return super.shouldOverrideUrlLoading(view, url);
		}
		
	}
}
